package com.szqhyxj.youxiangju.biz.merchantHome.shop.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.szqhyxj.youxiangju.R;
import com.szqhyxj.youxiangju.biz.merchantHome.bean.FacilityList;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * XiaoPanYu
 * on 2018/11/6
 */
public class FacilityListAdapter extends BaseAdapter{

    private final List<FacilityList> stockPOList;
    private final LayoutInflater from;

    public FacilityListAdapter(Context mContext, List<FacilityList> facilityList){
        stockPOList = facilityList;
        from = LayoutInflater.from(mContext);
    }

    @Override
    public int getCount(){
        return stockPOList.size();
    }

    @Override
    public Object getItem(int i){
        return stockPOList.get(i);
    }

    @Override
    public long getItemId(int i){
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup){
        if(view == null){
            view = from.inflate(R.layout.list_equipment_schedule_pop_itme, null);
            ViewHolder holder = new ViewHolder(view);
            view.setTag(holder);
        }
        ViewHolder viewHolder = (ViewHolder) view.getTag();
        FacilityList bean = stockPOList.get(i);
        viewHolder.posSn.setText(bean.getDevNo());
        viewHolder.price.setText(bean.getPrice());

        return view;
    }

    static class ViewHolder{
        @BindView(R.id.pos_sn)
        TextView posSn;
        @BindView(R.id.price)
        TextView price;

        ViewHolder(View view){
            ButterKnife.bind(this, view);
        }
    }
}
